"""
Author: Lucas
Date: 2024-05-11 07:34:38
LastEditors: Lucas
LastEditTime: 2024-05-13 02:46:41
Description: file content
"""

import yfinance as yf
from langchain_community.embeddings.sentence_transformer import (
    SentenceTransformerEmbeddings,
)
from matplotlib import pyplot as plt
from openbb import obb

from chat_client import get_client
from embedding import get_embedding
from utils import Raptor, ReportAnalysis

# define all the necessary variables
# os.environ["OPENAI_API_KEY"] = "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"
fmp_api_key = "Hdbw2F783Pfe0tXlwiwICojXQieVj1oP"  # "4YU3Jja7D9f0wj9EH757eme0IKdeHKxs"
obb.user.credentials.fmp_api_key = fmp_api_key

llm = "gpt-4-turbo-preview"
# llm = "llama3"
# embd = OpenAIEmbeddings()
# create the open-source embedding function
# embd = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")


# embd = get_embedding()
# client = get_client(llm)

# model = ChatOpenAI(temperature=0, model=llm)


# rag_helper = Raptor(client, embd)


def get_income_stmt(self):
    income_stmt = self.stock.financials
    return income_stmt


if __name__ == "__main__":
    # ra = ReportAnalysis(ticker_symbol)
    # ra.get_10k_section(7)
    # yf.Ticker("NVDA").financials
    # ra.get_income_stmt()  # .to_string().strip()
    # ra.analyze_segment_stmt()
    # ra.analyze_income_stmt()
    # ra.income_summarization()
    # ra.get_financial_metrics(years=5)

    ticker_symbol = "NVDA"
    stock = yf.Ticker(
        ticker_symbol,
    )
    print(stock)
    print("========")
    print(stock.info)
